import request from '@/utils/request'
/**
 * 历史故障列表
 */
export function findHistoryFault(query) {
  return request({
    url: '/repair/scyFaultRecordRead/findHistoryFault',
    method: 'get',
    params: query
  })
}
/**
 * 历史故障详情
 */
export function findHistoryFaultDetail(query) {
  return request({
    url: '/repair/scyFaultRecordRead/findHistoryFaultDetail',
    method: 'get',
    params: query
  })
}
/**
 * 跳闸数量
 * @param {string} searchTimeFlag 查询时间标识
 * @param {string} lineCode 线路代码
 * @param {string} lineSiteCode 区间站场代码
 */
export function getCountScy(query) {
  return request({
    url: '/repair/scyFaultRecordRead/countScyFaultRecords',
    method: 'get',
    params: query
  })
}
/**
 * 故障分析：统计故障数、跳闸数和事故数
 */
export function countFaultNums(query) {
  return request({
    url: '/repair/faultAnalysis/countFaultNums',
    method: 'get',
    params: query
  })
}
/**
 * 故障分析：故障分析：故障趋势分析
 */
export function faultTrendAnalysis(query) {
  return request({
    url: '/repair/faultAnalysis/faultTrendAnalysis',
    method: 'get',
    params: query
  })
}
/**
 * 故障分析：故障类型和故障定性环形图
 */
export function faultCircularGraph(query) {
  return request({
    url: '/repair/faultAnalysis/faultCircularGraph',
    method: 'get',
    params: query
  })
}
/**
 * 故障分析：按线路对比分析
 */
export function faultComparativeAnalysisByLine(query) {
  return request({
    url: '/repair/faultAnalysis/faultComparativeAnalysisByLine',
    method: 'get',
    params: query
  })
}
/**
 * 故障分析：按车间对比分析
 */
export function faultComparativeAnalysisByWorkshop(query) {
  return request({
    url: '/repair/faultAnalysis/faultComparativeAnalysisByWorkshop',
    method: 'get',
    params: query
  })
}
/**
 * 故障分析：故障原因分析
 */
export function faultReasonAnalysis(query) {
  return request({
    url: '/repair/faultAnalysis/faultReasonAnalysis',
    method: 'get',
    params: query
  })
}
/**
 * 故障分析：事故等级分析环形图
 */
export function faultGradeCircularGraph(query) {
  return request({
    url: '/repair/faultAnalysis/faultGradeCircularGraph',
    method: 'get',
    params: query
  })
}
/* 设备资产分析图表数据 */
/**
 * 损坏情况分析
 * @param {string} searchTimeFlag 查询时间标识 year/month（年/月）
 * @param workshopId (String)
 * @param deptId (String)
 * @param lineId (String)
 * @param siteId (String)
 * @param devClassId (String) 多个以逗号分割
 * @return x: x轴时间,y: y轴缺陷数量
 */
export function getDefectStatus(query) {
  return request({
    url: '/repair/jcwDefectInfoRead/defectStatusAnalysis',
    method: 'get',
    params: query
  })
}
/**
 * 发生缺陷的设备数量
 * @param workshopId (String)
 * @param deptId (String)
 * @param lineId (String)
 * @param siteId (String)
 * @param devClassId (String) 多个以逗号分割
 */
export function getDefectDevCount(query) {
  return request({
    url: '/repair/jcwDefectInfoRead/countJcwDefectInfoDevices',
    method: 'get',
    params: query
  })
}
/**
 * 设备缺陷分析
 * @param workshopId (String)
 * @param deptId (String)
 * @param lineId (String)
 * @param siteId (String)
 * @param devClassId (String) 多个以逗号分割
 */
export function getDefectDevInfo(query) {
  return request({
    url: '/repair/jcwDefectInfoRead/deviceJcwDefectInfoAnalysis',
    method: 'get',
    params: query
  })
}
/**
 * 厂家对应设备缺陷分析
 * @param workshopId (String)
 * @param deptId (String)
 * @param lineId (String)
 * @param siteId (String)
 * @param devClassId (String) 必填
 */
export function getDefectDevMfrs(query) {
  return request({
    url: '/repair/jcwDefectInfoRead/mfrsDeviceJcwDefectInfoAnalysis',
    method: 'get',
    params: query
  })
}
/**
 * 故障趋势分析图表数据
 * @param lineCode (String)
 * @param lineSiteCode (String)
 * @param yearParam (String) 年月份
 */
export function getTroubleChart(query) {
  return request({
    // baseURL: 'mock',
    url: '/repair/scyFaultRecordRead/faultNumByYear',
    method: 'get',
    params: query
  })
}
/**
 * 跳闸趋势分析图表数据
 * @param lineCode (String)
 * @param lineSiteCode (String)
 */
export function getTripChart(query) {
  return request({
    // baseURL: 'mock',
    url: '/repair/scyFaultRecordRead/scyFaultRecordAnalysis',
    method: 'get',
    params: query
  })
}
